import Vue from 'vue'
import Vuex from 'vuex'
let _this = new Vue();
const servePath = '/public/mp'
const serve = {
	login(code, success, fail) {
		_this.$ajax.servePost({
			url: servePath + '/login',
			data: {
				code: code
			},
			success(res) {
				if (res.code == 0) {
					_this.$store.state.user.openId = res.data.openId
					_this.$store.state.user.token = res.data.token
				}
				success(res)
			}
		})
	},
	register(data, success, fail) {
		_this.$ajax.servePost({
			url: servePath + '/register',
			data: data,
			success(res) {
				console.log(res)
			}
		})
	}
}
export default serve
